// stores/counter.js
import { defineStore } from 'pinia'

export const useCounterStore = defineStore('counter', {
  state: () => {
    let num = Number(localStorage.getItem('count')) || 0
    return {
      count: num
    }
  },
  actions: {
    increment() {
      this.count++
      localStorage.setItem('count', String(this.count))
    }
  }
})